import {Controller, Logger, OnModuleInit, Post} from "@nestjs/common";
import {IsNotEmpty} from "class-validator";
import {AppService} from "./app.service";
import {AuthService} from "./auth/auth.service";

export class TestValidation {
  @IsNotEmpty()
  name: string;
}

@Controller()
export class AppController implements OnModuleInit {
  constructor(
    private readonly appService: AppService,
    private readonly authService: AuthService
  ) {
  }

  async onModuleInit() {
    const accessToken = await this.authService.login({username: "atom.hu", id: 12345})
    Logger.log(`accessToken: ${JSON.stringify(accessToken)}`)
  }


  @Post()
  async getHello(): Promise<any> {
    return this.authService.login({username: "atom.hu", id: 1234});
  }
}
